from time import sleep

from selenium import webdriver

driver = webdriver.Firefox()
driver.get('https://www.baidu.com/')

key_word = driver.find_element_by_id('kw')
key_word.send_keys('163邮箱登录')
sleep(2)
driver.find_element_by_id('su').click()

sleep(2)
driver.find_element_by_partial_link_text('163网易免费邮--中文邮箱第一品牌').click()

sleep(2)
hds=driver.window_handles
driver.switch_to.window(hds[1])
sleep(4)
str = driver.find_element_by_tag_name("iframe")
driver.switch_to.frame(str)

sleep(2)
driver.find_element_by_name('email').clear()
driver.find_element_by_name('email').send_keys('zcb117852')
driver.find_element_by_name('password').clear()
driver.find_element_by_name('password').send_keys('Zhu1178521658')
driver.find_element_by_link_text('登  录').click()

sleep(2)
driver.switch_to.default_content()
sleep(2)
driver.find_element_by_id('_mail_component_24_24').click()

sleep(2)
driver.find_element_by_css_selector('.nui-editableAddr-ipt').send_keys('ma_linpop@163.com')
#ma_linpop@163.com
sleep(2)
str = driver.find_elements_by_class_name('nui-ipt-input')
str[2].send_keys('化工学院_计172班_朱昌斌  自动化发送邮件')

sleep(2)
std = driver.find_element_by_class_name('APP-editor-iframe')
driver.switch_to.frame(std)

sleep(2)
#driver.find_element_by_css_selector('body').send_keys('zxzxc')
driver.find_element_by_class_name('nui-scroll').send_keys('吃葡萄不吐葡萄皮！！！')

sleep(2)
driver.switch_to.default_content()

sleep(5)
driver.find_element_by_id('_mail_button_8_200').click()
